package com.antler.smt.portal.controller;

import com.antler.smt.portal.annotation.OperateCut;
import com.antler.smt.portal.utils.FormatListUtil;
import com.antler.smt.request.portal.ResumeReq;
import com.antler.smt.response.base.Result;
import com.antler.smt.service.portal.ClassifyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 分类筛选
 *
 * @author zhangyi
 * @date 2018/9/26 14:50
 */
@RestController
@RequestMapping("/classify")
@Api(description = "分类筛选")
public class ClassifyController {

    @Resource
    private ClassifyService classifyService;

    /**
     * 筛选简历库
     *
     * @param resumeReq
     * @return
     */
    @GetMapping("/getPeopleResume")
    @ApiOperation(value = "筛选简历库",httpMethod = "GET")
    @OperateCut(operationContent = "获取简历列表")
    public Result getPeopleResumes(ResumeReq resumeReq){

        return classifyService.getPeopleResumes(resumeReq);
    }

    /**
     * 获取简历详情
     *
     * @param peopleId
     * @return
     */
    @GetMapping("/getResumeDetailed/{peopleId}")
    @ApiOperation(value = "获取简历详情",httpMethod = "GET")
    @OperateCut(operationContent = "获取简历列表")
    public Result getResumeDetailed(@PathVariable(value = "peopleId") Long peopleId){

        return classifyService.getResumeDetailed(peopleId);
    }

    /**
     * 根据金额筛选项目
     *
     * @param salaryRange
     * @return
     */
    @GetMapping("/getRecruitment/{salaryRange}")
    @ApiOperation(value = "根据金额筛选项目",httpMethod = "GET")
    @OperateCut(operationContent = "根据金额筛选项目传入（0,10 或者 10,15 等等）")
    public Result getProjects(@PathVariable(value = "salaryRange") String salaryRange){
        List<Integer> integerList = FormatListUtil.pareIntLists(salaryRange);
        return classifyService.getProjects(integerList);
    }

    /**
     * 筛选招聘要求
     *
     * @param resumeReq
     * @return
     */
    @GetMapping("/getRequirements")
    @ApiOperation(value = "筛选招聘要求",httpMethod = "GET")
    @OperateCut(operationContent = "筛选招聘要求")
    public Result getRequirements(ResumeReq resumeReq){

        return classifyService.getRequirements(resumeReq);
    }

}
